
public class Car {
	
 private static final int MIN_SPEED = 0;
 private static final int MAX_GEAR = 6;
 private static final int MIN_DOORS = 2;
 private static final int MIN_GEAR = 1;
 protected String model;
 protected double currentSpeed;
 protected int currentGear;
 protected int numberOfDoors;
 protected int idNumber;
 protected boolean isSportsCar = true;
 protected Person owner;
 
 Car(){
	 model = "";
	 currentSpeed = MIN_SPEED;
	 currentGear = MIN_GEAR;
	 numberOfDoors = MIN_DOORS;
	 idNumber = 0;
	 isSportsCar = false;
	 owner = new Person();
 }
 Car(Person owner, String model){
	 this();
	 setOwner(owner);
	 setModel(model);
 }
 
 Car(Person owner, String model,int idNumber, int numberOfDoors, boolean isSportsCar){
	 this(owner, model);
	 setIdNumber(idNumber);
	 setNumberOfDoors(numberOfDoors);
	 this.isSportsCar = isSportsCar;
 }
 
public String getModel() {
	return model;
}
public int getNumberOfDoors() {
	return numberOfDoors;
}
public void setNumberOfDoors(int numberOfDoors) {
	if(numberOfDoors >0)
	this.numberOfDoors = numberOfDoors;
}
public int getIdNumber() {
	return idNumber;
}
public void setIdNumber(int idNumber) {
	if(idNumber > 0)
	this.idNumber = idNumber;
}
public void setModel(String model) {
	if(model!=null && model.length()>0)
	this.model = model;
}
public Person getOwner() {
	return owner;
}
public void setOwner(Person owner) {
	if(owner !=null)
	this.owner = owner;
}
 
 void changeOwner(Person newOwner){
	 System.out.println("Dealing for the car.");
		 setOwner(newOwner);
	 }
 void startEngine(){
	 System.out.println("Brum-brum, says the started engine.");
 }
 
 void changeGear(int gear){
	 if(gear >= MIN_GEAR && gear <= MAX_GEAR){
		 this.currentGear = gear;
	 } 
 }
 
 void accelerate(double speed){
	 if(speed > MIN_SPEED){
		 this.currentSpeed = speed;
	 }
 }
 
 @Override
	public String toString() {
		
		return "Model: " +model + " current speed: "+ currentSpeed + " gear: "+currentGear + " owner: " + owner + " idNum: "+idNumber + " num of doors: " + numberOfDoors;
	}
 
 @Override
	public boolean equals(Object obj) {
	 Car car = (Car) obj;
	 if(this.getModel().equals(car.getModel()) ){
		 return true;
	 }
	 
		return false;
	}
 
 
}
